#include "stdafx.h"
#include "truetype_maxp.h"
#include "truetype.h"

void truetype_maxp(truetype_t * tt, tt_table_t * table)
{
	if(!tt || !tt->stream || !table || table->type != tt_table_type_maxp)
		return ;
	base_stream_t * stream = tt->stream;

	tt_maxp_t maxp;
	stream->seeker(stream, table->offset, stream_seek_begin);
	stream->reader(stream, &maxp, sizeof(tt_maxp_t));
#ifdef TT_SMALL_ENDIAN
	tt->glyf_count = confirm_big_word(maxp.glyf_count);
	tt->max_points = confirm_big_word(maxp.max_points);
	tt->max_contours = confirm_big_word(maxp.max_contours);
	tt->max_composite_points = confirm_big_word(maxp.max_composite_points);
	tt->max_composite_contours = confirm_big_word(maxp.max_composite_contours);
#else
	tt->glyf_count = maxp.glyf_count;
	tt->max_points = maxp.max_points;
	tt->max_contours = maxp.max_contours;
	tt->max_composite_points = maxp.max_composite_points;
	tt->max_composite_contours = maxp.max_composite_contours;
#endif // TT_SMALL_ENDIAN
}
